package kz.vokebuz;

import android.app.Activity;
import android.app.KeyguardManager;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.Window;
import android.widget.TextView;

public class PopUpActivity extends Activity {
	private static final String TAG = PopUpActivity.class.getSimpleName();

	private TextView name;
	private TextView surname;
	private TextView msgBody;
	private KeyguardManager.KeyguardLock myLock;
	private KeyguardManager myKeyGuardManager;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub

		requestWindowFeature(Window.FEATURE_NO_TITLE);
		super.onCreate(savedInstanceState);
		setContentView(R.layout.popupactivity);

		myKeyGuardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
		myLock = myKeyGuardManager.newKeyguardLock("keygurard_unlock");
		if (myKeyGuardManager.inKeyguardRestrictedInputMode()){
	        myLock.disableKeyguard();
	        Log.d(TAG,"unlock_guard");
	    }

		Log.d(TAG, "popActivity started");

		name = (TextView) findViewById(R.id.popName);
		surname = (TextView) findViewById(R.id.popsurname);
		msgBody = (TextView) findViewById(R.id.popMessageBody);
		doWriteFields();

	}

	private void doWriteFields() {
		
		name.append("Rustam");
		surname.append("Uzbekov");
		msgBody.append(getIntent().getExtras().getString("msg")+ " ");
		
	}

	@Override
	protected void onStart() {

		super.onStart();

	}


	@Override
	protected void onStop() {
		myLock.reenableKeyguard();
		//myLock = null;
		super.onPause();

	

	}



}
